﻿
////////////////////////////////////////////////////////////////////////////////////////////
// 文件名: ETL_Target_View_ColumnConfigBLL.gen.cs
//
// 模块名称: TargetViewColumnBll
//
// 作者: LPC
//
// 历史记录（记录修改记录，修改文件后请添加修改记录，注明修改时间、修改人，修改内容）:
// 13-3-8    LPC    创建文件
////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Text;
using Common;
using DAL;
using Model;

namespace BLL
{
    /// <summary>
    /// ETL_Target_View_ColumnConfig表业务逻辑层
    /// </summary>
    public partial class ETL_Target_View_ColumnConfigBLL : BaseBLL
    {
        public ETL_Target_View_ColumnConfigBLL(LoginInfo info)
        {
            loginInfo = info;
        }
        const string ErrorCodeSelect = "";    //查询异常编码
        const string ErrorCodeInsert = "";    //添加异常编码
        const string ErrorCodeUpdate = "";    //修改异常编码
        const string ErrorCodeDelete = "";    //删除异常编码

        /// <summary>
        /// 根据GUID字段获取ETL_Target_View_ColumnConfigInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <returns>ETL_Target_View_ColumnConfigInfo实体对象</returns>
        public ETL_Target_View_ColumnConfigInfo GetInfoById(string guid)
        {
            try
            {
                return new ETL_Target_View_ColumnConfigDAL(loginInfo).GetInfoById(guid);
            }
            catch (Exception ex)
            {
                Logger.LogError("ETL_Target_View_ColumnConfigBLL", "GetInfo", AppError.EROR, 0, ex, "获取TargetViewColumnBll信息出错。",
                                String.Format("guid = {0}", guid));
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        /// <summary>
        /// 往ETL_Target_View_ColumnConfig表内添加新记录
        /// </summary>
        /// <param name="ETL_Target_View_ColumnConfigInfo">ETL_Target_View_ColumnConfigInfo实体对象</param>
        /// <returns>添加记录索引值</returns>
        public int Insert(ETL_Target_View_ColumnConfigInfo eTLTargetViewColumnConfigInfo)
        {
            try
            {
                int identity = new ETL_Target_View_ColumnConfigDAL(loginInfo).Insert(eTLTargetViewColumnConfigInfo);
                return identity;
            }
            catch (Exception ex)
            {
                Logger.LogError("ETL_Target_View_ColumnConfigBLL", "Insert", AppError.EROR, 0, ex, "添加TargetViewColumnBll信息出错。", null);
                throw new SystemException(ErrorCodeInsert, ex);
            }
        }

        /// <summary>
        /// 更新ETL_Target_View_ColumnConfig表记录
        /// </summary>
        /// <param name="ETL_Target_View_ColumnConfigInfo">ETL_Target_View_ColumnConfigInfo实体对象</param>
        public void Update(ETL_Target_View_ColumnConfigInfo eTLTargetViewColumnConfigInfo)
        {
            try
            {
                new ETL_Target_View_ColumnConfigDAL(loginInfo).Update(eTLTargetViewColumnConfigInfo);
            }
            catch (Exception ex)
            {
                Logger.LogError("ETL_Target_View_ColumnConfigBLL", "Update", AppError.EROR, 0, ex, "更新TargetViewColumnBll信息出错。",
                                String.Format("GUID = {0}", eTLTargetViewColumnConfigInfo.Guid));
                throw new SystemException(ErrorCodeUpdate, ex);
            }
        }

        /// <summary>
        /// 根据GUID字段获取ETL_Target_View_ColumnConfigInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        public void Delete(string guid)
        {
            try
            {
                new ETL_Target_View_ColumnConfigDAL(loginInfo).Delete(guid);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool RemoveViewMapping(string viewID, string sourceViewIDs)
        {
            try
            {
               return new ETL_Target_View_ColumnConfigDAL(loginInfo).RemoveViewMapping(viewID, sourceViewIDs);
            }
            catch (Exception ex)
            { 
                throw ex;
            }
        }


        /// <summary>
        /// 根据GUID字段获取ETL_Target_View_ColumnConfigInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <returns>List<ETL_Target_View_ColumnConfigInfo>实体对象</returns>
        public List<ETL_Target_View_ColumnConfigInfo> GetList(IDataParameter[] par)
        {
            try
            {
                return new ETL_Target_View_ColumnConfigDAL(loginInfo).GetList(par);
            }
            catch (Exception ex)
            {
                Logger.LogError("ETL_Target_View_ColumnConfigBLL", "GetInfo", AppError.EROR, 0, ex, "获取TargetViewColumnBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        /// <summary>
        /// 根据GUID字段获取ETL_Target_View_ColumnConfigInfo实体对象
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <returns>List<ETL_Target_View_ColumnConfigInfo>实体对象</returns>
        public int GetListCount(IDataParameter[] par)
        {
            try
            {
                return new ETL_Target_View_ColumnConfigDAL(loginInfo).GetListCount(par);
            }
            catch (Exception ex)
            {
                Logger.LogError("ETL_Target_View_ColumnConfigBLL", "GetInfo", AppError.EROR, 0, ex, "获取TargetViewColumnBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        public List<ETL_Target_View_ColumnConfigInfo> GetViewColumn(SqlParameter[] viewColumnPar)
        {
            try
            {
                return new ETL_Target_View_ColumnConfigDAL(loginInfo).GetViewColumn(viewColumnPar);
            }
            catch (Exception ex)
            {
                Logger.LogError("ETL_Target_View_ColumnConfigBLL", "GetInfo", AppError.EROR, 0, ex, "获取TargetViewColumnBll信息出错。",
                                "");
                throw new SystemException(ErrorCodeSelect, ex);
            }
        }

        #region ETL_Target_View_ColumnConfig
        /// <summary>
        /// 取对接视图字段列表
        /// </summary>
        /// <param name="viewID">视图id</param>
        /// <param name="getall">0:未删除，1已删除，2所有字段</param>
        /// <returns></returns>
        public List<ETL_Target_View_ColumnConfigInfo> GetTargetViewColumnConfigByViewID(string viewID, int getall)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.GetTargetViewColumnConfigByViewID(viewID, getall);
        }
        public ETL_Source_View_ColumnConfigInfo GetMapSourceInfo(string viewID)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.GetMapSourceInfo(viewID);
        }

        public int DeleteColumnANDWhereConditionByColumnID(string columnID)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.DeleteColumnANDWhereConditionByColumnID(columnID);
        }

        public int DeleteWhereConditionByColumnID(string columnID)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.DeleteWhereConditionByColumnID(columnID);
        }

        public int InsertColumnConfig(ETL_Target_View_ColumnConfigInfo columnConfigInfo)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.InsertColumnConfig(columnConfigInfo);
        }

        public int InsertViewColumnMapping(ViewColumnMapping maping)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.InsertViewColumnMapping(maping);
        }
        public int InsertViewMapping(string viewid,string sviewid)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.InsertViewMapping(viewid, sviewid);
        }
        public int UpdateColumnConfig(ETL_Target_View_ColumnConfigInfo columnConfigInfo)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.UpdateColumnConfig(columnConfigInfo);
        }

        public int InsertWhereCondition(ETL_Target_View_ColumnConfig_WhereConditionInfo whereConditionInfo)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.InsertWhereCondition(whereConditionInfo);
        }
        public int DeleteColumnMaping(string viewid)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.DeleteColumnMaping(viewid);
        }
        public int AddColumnMaping(string viewid, string sourceViewid)
        {
            ETL_Target_View_ColumnConfigDAL dal = new ETL_Target_View_ColumnConfigDAL(loginInfo);
            return dal.AddColumnMaping(viewid, sourceViewid);
        }
        #endregion

    }
}